{% include "head.html" %}

  <div id="stage" class="clearfix">
    <div class="content">      
      <div id="editbookmark" class="post"> <span class="absolute box_2_t_l"></span> <span class="absolute box_2_t_r"></span> <span class="absolute box_2_b_l"></span> <span class="absolute box_2_b_r"></span>
        {% ifequal mode "edit" %} {% include template/editbookmark_form.html %}
            <form id="editbookmarkform" enctype="multipart/form-data" action="/admin/bookmark/edit" method="post">
              <input type="hidden" name="id" id="id" value="{{bookmark.id}}" />
            	<label for="category">Category:</label> <br />
            	<select name="category" id="category">
            	  {% for category in categorys %}            	  
            	  <option value="{{category.id}}" {% ifequal bookmark.category.id category.id %} SELECTED="true" {% endifequal %}>{{category.name}}</option>
            	  {% endfor %}
            	</select><br />
            	
            	<label for="url">URL:</label> <br />
            	<input name="url" id="url" maxlength="200" value="{{bookmark.url}}" />
            	<input value="Get url data" type="button" id="btnajax" name="btnajax" /><br>
            	
            	<label for="id_file">File:</label> <input type="file" name="file" id="file" /><br>
            	
            	<label for="name">Name:</label> <br />
            	<input name="name" id="name" maxlength="100" value="{{bookmark.name}}" /><br />            	
            	
            	<label for="tags">Tags:</label> <br />
            	<input name="tags" id="tags" maxlength="100" value="{% for tag in bookmark.tags %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}" /><br />
            	
            	<label for="privilege">privilege:</label> <br />
            	<select name="privilege" id="privilege">            	   
            	  <option value="public" {% ifequal bookmark.privilege 'public' %} SELECTED="true" {% endifequal %}>public</option>
            	  <option value="private" {% ifequal bookmark.privilege 'private' %} SELECTED="true" {% endifequal %}>private</option>
            	</select><br />
            	
            	<label for="description">Description:</label> <br />
            	<textarea name="description" id="description">{{bookmark.description}}</textarea><br />
            	
            	<input type="submit" value="Submit Post" />
            </form>            
            {% endifequal %}
            {% ifequal mode "add" %}
            <form id="editbookmarkform" action="/admin/bookmark/add" enctype="multipart/form-data" method="post">
            	<label for="category">Category:</label> <br />
            	<select name="category" id="category">
            	  {% for category in categorys %}
            	  <option value="{{category.id}}">{{category.name}}</option>
            	  {% endfor %}
            	</select><br />
            	
            	<label for="url">URL:</label> <br />
            	<input name="url" id="url" maxlength="200" />
            	<input value="Get url data" type="button" id="btnajax" name="btnajax" /><br>
            	
            	<label for="id_file">File:</label> <input type="file" name="file" id="file" /><br>
            	
            	<label for="name">Name:</label> <br />
            	<input name="name" id="name" maxlength="100" /><br />
            	
            	<label for="tags">Tags:</label> <br />
            	<input name="tags" id="tags" maxlength="100" /><br />
            	
            	<label for="privilege">privilege:</label> <br />
            	<select name="privilege" id="privilege">            	   
            	  <option value="public" >public</option>
            	  <option value="private" >private</option>
            	</select><br />
            	
            	<label for="description">Content:</label> <br />
            	<textarea name="description" id="description"></textarea><br />
            	
            	<input type="submit" value="Submit Post" />
            </form>            
            {% endifequal %}
            <p class="ajax ajaxResult">&nbsp;</p>
      </div>
      <!-- /post-nav -->
    </div>
    <div class="sidebar">

      <div class="mob"> <span class="absolute box_2_t_l"></span> <span class="absolute box_2_t_r"></span> <span class="absolute box_2_b_l"></span> <span class="absolute box_2_b_r"></span>
        <!-- begin popular posts -->
        <h2>Category List</h2>
        <a href="/admin/category/add">Add a Category</a><p>        
        {% for category in categorys %}<a href="/category/{{category.id}}">{{category.name}}</a> <a href="/admin/category/edit/{{category.id}}" >edit</a> | <a href="/admin/category/delete/{{category.id}}" >delete</a><br>{% endfor %}
        
      <!-- end popular posts -->  
      </div>

    </div>
  </div>
</div>
{% include "footer.html" %}

